package com.jdls.tanhua.vo;

import com.jdls.tanhua.mongo.UserLike;
import com.jdls.tanhua.mongo.Visitors;
import com.jdls.tanhua.pojo.UserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author 嘉德罗斯
 * @date 2021/11/5
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class VisitorsVo implements Serializable {
    private Integer id;             //编号
    private String avatar;          //头像
    private String nickname;        //昵称
    private String gender;          //性别 man woman
    private Integer age;            //年龄
    private String city;            //城市
    private String education;       //学历
    private Integer marriage;       //婚姻状态（0未婚，1已婚）
    private Integer matchRate = 60;      //匹配度
    private Boolean alreadyLove = false;    //是否喜欢ta

    public static VisitorsVo init(UserInfo userInfo){
        VisitorsVo visitorsVo = new VisitorsVo();
        if (userInfo.getAge()!=null){
            visitorsVo.setAge(Integer.valueOf(userInfo.getAge()));
        }
        visitorsVo.setAvatar(userInfo.getAvatar());
        visitorsVo.setCity(userInfo.getCity());
        visitorsVo.setEducation(userInfo.getEducation());
        visitorsVo.setGender(userInfo.getGender());
        visitorsVo.setId(Math.toIntExact(userInfo.getId()));
        visitorsVo.setMarriage(userInfo.getMarriage());
        visitorsVo.setNickname(userInfo.getNickname());

        return visitorsVo;
    }

}
